import React from 'react';
import { Route, Switch } from 'react-router-dom';
// 私有组件方法
import PrivateRouter from "../privateRouter/Index";
/** 自动化工程 */
import Components from "./components";
import PublicDomainDetail from '../../pages/domain/Details';
import GroupDetail from '../../pages/galaxy/GroupDetails';
// css
import "./index.scss";

// 404 页面
function NotFound() {
  return (
    <div className='containerNotfound'>
      <div className='imgBlock'>
        <div className='img'/>
      </div>
      <div>
        <h1 className='title'>404</h1>
        <div className='desc'>抱歉，你访问的页面不存在</div>
      </div>
    </div>
  )
}

class ContainerMain extends React.Component {
  constructor(props){
    super(props);
    this.state = {};
  }
  render(){
    return (
        <Switch>
          {
            Components.map(item => {
              return <PrivateRouter exact key={item.path} path={item.path} component={item.component} />
            })
          }
          {/* 自定义router */}
          <PrivateRouter exact component={PublicDomainDetail} path="/index/domain/details/:DomainName" />
          <PrivateRouter exact component={GroupDetail} path="/index/galaxy/groupdetails/:group_id" />
          <Route component={NotFound}></Route>
        </Switch>
    )
  }
}
export default ContainerMain;
